package org.windey.server.web;

import java.util.ArrayList;
import java.util.List;

import org.windey.server.database.Md5Generator;
import org.windey.server.database.Pc;
import org.windey.server.database.User;


public class PcOverview {
	
	private User user;

	public PcOverview(User user) {
		setUser(user);
	}
	
	public void setUser(User user) {
		this.user = user;
	}

	public User getUser() {
		return user;
	}

	public String generate() {
		Md5Generator md5 = new Md5Generator();
		String s = "<p>Your overview</p><ul>";
		List<Pc> pcs = user.getPcs();
		for (Pc p : pcs) {
			s += "<li>";
			s += "<a href\"control.jsp?key=";
			String hash = md5.generateMD5(getUser().getEmail() + ";" + getUser().getPasword() + ";" + p.getName());
			s += hash + "\">" + p.getName() + "</a></li>";
		}
		s += "</ul>";
		
		
		return "";
	}
	
}
